﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%
if qingtian.bbs<>true then
	Response.Redirect "/index.asp?sid="&sidd
	Response.end
end if
IF  Request.QueryString("Action")="save" Then
	call savea
else
	call index
end if
end Function
Function index
	dim rs,sql,Runtxt,str
	Runtxt=qingtian.RunStr
	dim id,url,urls
    		id = Request.QueryString("id")    
    		If id = "" Then id = 1
   		If Not IsNumeric(id) Then id = 1
    		id = CLng(id)
    		If id < 0 Then id = 1
                url=Request.QueryString("url") 
                urls=replace(url,"@@","&amp;")
select case v
case "0"
we0="<br/>"
hr="-------------<br/>"
%>
<card title="添加栏目"><p align="<%=qingtian.px%>">
<%
case "1"
hr=""
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>添加栏目</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%

End Select
if v=1 then Response.Write (""&we&"<form action=""addbannji.asp?Action=save&amp;id="&id&"&amp;url="&url&"&amp;sid="&sidd&""" method=""post"">")
%>		
	栏目名称：<br/>
	<input emptyok="true"  name="name" maxlength="50" value="" type="text"/><br/>
	栏目排序：<br/>
	<input emptyok="true"  name="nid" format="*N" value="" type="text"/><br/>
	栏目内容：<br/>
<%if v=1 then%>
        <textarea name="content" rows="3"/></textarea><br/>
<%else%>
	<input emptyok="true"  name="content"  value="" type="text"/><br/>
<%end if
if v=1 then
        Response.Write ("<input type=""submit"" value=""确定提交"" /></form><br/>")
else%>
	<anchor>确定提交
    	<go href="addbannji.asp?Action=save&amp;url=<%=url%>&amp;id=<%=id%>&amp;sid=<%=sidd%>" method='post'>
        <postfield name="name" value="$(name)"/>
        <postfield name="nid" value="$(nid)"/>
        <postfield name="content" value="$(content)"/>
    	</go>
	</anchor><br/>
<%end if%><a href='bannji.asp?url=<%=url%>&amp;id=<%=id%>&amp;sid=<%=sidd%>'>返回栏目管理</a><%=we0%>
<%=sou%><a href='<%=urls%>'>返回来源页</a><%=we0%>

<%
end Function 


Function savea
	dim pid
    		pid = Request.QueryString("id")    
    		If pid = "" Then pid = 0
   		If Not IsNumeric(pid) Then pid = 0
    		pid = CLng(pid)
    		If pid < 0 Then pid = 0

		dim name,content,nid,errs,rs,sql
		name=Request.form("name")
		nid=Request.form("nid")
		content=Request.form("content")

		errs=""
		if name="" then errs=errs & "栏目名称不能为空<br/>"
		if nid="" then errs=errs & "栏目排序不能为空<br/>"
		if content="" then errs=errs & "栏目内容不能为空<br/>"
	dim url,urls
                url=Request.QueryString("url") 
                urls=replace(url,"@@","&amp;")
select case v
case "0"
we0="<br/>"
hr="-------------<br/>"
%>
<card title="添加栏目"><p align="<%=qingtian.px%>">
<%
case "1"
hr=""
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>添加栏目</title><%=we%>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%

End Select
	IF len(errs)=0 then


		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select  * FROM qingtian_showclass"
		rs.open sql,conn,1,3
		rs.addnew
			rs("name")=name
			rs("pid")=pid
			rs("nid")=nid
			rs("content")=content
		rs.update()
		rs.Close
		Set rs = Nothing
	%>
		添加栏目成功!<br/><%

	else%>

		<%=errs%>
		<a href="addbannji.asp?url=<%=url%>&amp;id=<%=pid%>&amp;sid=<%=sidd%>">返回修改</a><br/>
<%	end if
%><a href='bannji.asp?url=<%=url%>&amp;id=<%=pid%>&amp;sid=<%=sidd%>'>返回栏目管理</a><br/>
<a href='<%=urls%>'>返回来源页</a><%=we0%>

   <%
end Function
%>
